package com.commerceE.util;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class Constant {
	
	public static int pageNumber = 5;
	
	public static String IMAGE_TYPE_PRODUCT_SMALL = "product_small";
	
	public static String IMAGE_TYPE_PRODUCT_BESTBUY = "product_bestbuy";

	public static String IMAGE_TYPE_PRODUCT_REGULAR = "product_regular";
	
	public static String IMAGE_TYPE_HOMEPAGE_MAIN = "homepage_main";
	
	private static List<String> imagesTypeList =null;
	
	
	public static String PAYMENT_STATUS_UNPAID = "未付款";
	
	public static String PAYMENT_STATUS_PAID = "已付款";
	
	public static String PAYMENT_STATUS_RETURNED = "已经申请退货";
	
	
	public static String DELIVERY_STATUS_UNDELIVERED = "未发货";
	
	public static String DELIVERY_STATUS_DELIVERED = "已发货";
	
	public static String DELIVERY_STATUS_RECEIVED = "已收货";
	
	public static final String APP_PROPERTITY_FILE = "application.properties";

	
	public static List<String> getImagesTypeList(){
		if(imagesTypeList==null){
			imagesTypeList = new ArrayList<String>();
			imagesTypeList.add(IMAGE_TYPE_PRODUCT_SMALL);
			imagesTypeList.add(IMAGE_TYPE_PRODUCT_BESTBUY);
			imagesTypeList.add(IMAGE_TYPE_PRODUCT_REGULAR);
			imagesTypeList.add(IMAGE_TYPE_HOMEPAGE_MAIN);
		}
		return imagesTypeList;
	}
	
	private static Map<Integer,Integer> pageLimitMap  ;
	 
	public static Map<Integer,Integer> getPageLimitMap(){
		if(pageLimitMap==null){
			pageLimitMap =  new LinkedHashMap<Integer,Integer>();
			pageLimitMap.put(12, 12);
			pageLimitMap.put(25, 25);
			pageLimitMap.put(50, 50);
			pageLimitMap.put(100, 100);
		}
		return pageLimitMap;
	}
	
	private static Map<String,String> sortByMap  ;
	 
	public static Map<String,String> getSortByMap(){
		if(sortByMap==null){
			sortByMap =  new LinkedHashMap<String,String>();
			sortByMap.put("", "Default");
			sortByMap.put("discountPrice asc", "Price (Low &gt; High)");
			sortByMap.put("discountPrice desc", "Price (High &gt; Low)");
		}
		return sortByMap;
	}
	
	private static Boolean ehcache_flag = null;
	
	public static Boolean getEHCacheFlag(){
		if(ehcache_flag==null){
			String str = PropertyUtil.getValueByKey("ehcache_flag");
			ehcache_flag = ( str!=null?new Boolean(str):false);
		}
		return ehcache_flag;
	}
}
